//
//  IndentDetailViewController.m
//  Globalstone
//
//  Created by 刘建峰 on 16/7/7.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "IndentDetailViewController.h"

@interface IndentDetailViewController ()
@property (weak, nonatomic) IBOutlet UIView *navView;
@property (weak, nonatomic) IBOutlet UIScrollView *scroView;
@property (weak, nonatomic) IBOutlet UIView *indentInfoView;
@property (weak, nonatomic) IBOutlet UIView *transInfoView;
@property (weak, nonatomic) IBOutlet UILabel *indentNum;
@property (weak, nonatomic) IBOutlet UILabel *indentName;
@property (weak, nonatomic) IBOutlet UILabel *indentType;
@property (weak, nonatomic) IBOutlet UILabel *indentAddress;

//订仓信息
@property (weak, nonatomic) IBOutlet UILabel *transCompanyName;
@property (weak, nonatomic) IBOutlet UILabel *transDate;
@property (weak, nonatomic) IBOutlet UILabel *boatDate;
@property (weak, nonatomic) IBOutlet UILabel *beginDate;
@property (weak, nonatomic) IBOutlet UILabel *weight;

@end

@implementation IndentDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initViewLayout];
    [self getOrderExportDetail];
}

- (void)initViewLayout{
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.scroView];
    [self adaptiveViewLayout:self.indentInfoView];
    [self adaptiveViewLayout:self.transInfoView];
    
    _scroView.contentSize = flexibleSize(CGSizeMake(0, 505), NO);
}

- (IBAction)back:(id)sender {
    [self backBtn];
}

#pragma mark === 订单基本信息
- (void)getOrderExportDetail{
    NSMutableDictionary  *dic=[NSMutableDictionary dictionary];
    [dic setObject:[Common getLoginInfo][Key_User_userId] forKey:@"museId"];
    [dic setObject:[Common getLoginInfo][Key_User_password] forKey:@"musePwd"];
    [dic setObject:[Common getLoginInfo][Key_User_onlineKey] forKey:@"museOnlineTag"];
    NSString * lan = [InternationalControl userLanguage];
    if ([lan isEqualToString:@"en"]) {
        [dic setObject:@"2" forKey:@"language"];
    }else{
        [dic setObject:@"1" forKey:@"language"];
    }
     [dic setObject:_indentId forKey:@"oexpId"];
    self.shareApi.delegate=self;
    [self.shareApi  requestOperationWithDic:dic withPath:GS_queryOrderExportDetail withHttpType:@"POST" withTag:GS_GS_queryOrderExportDetail];
}



#pragma   mark---- GetADBanner Request Delegate

-(void)fetchDatabaseFinished:(NSMutableDictionary *)database withTag:(NSInteger)tag{
    
    if (tag==GS_GS_queryOrderExportDetail) {
        
        if (  [[database valueForKey:@"flag"] integerValue]!=1 ) {
            
            [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:1.5];
            
        }else  {
            NSDictionary * dic = database[@"result"];
            _indentType.text = [NSString stringWithFormat:@"%@",dic[@"PortType"]];
            _indentName.text = [NSString stringWithFormat:@"%@",dic[@"oexpName"]];
            _indentNum.text =  [NSString stringWithFormat:@"%@",dic[@"oexpNo"]];
            _indentAddress.text =  [NSString stringWithFormat:@"%@",dic[@"address"]];
            
            _transCompanyName.text =  [NSString stringWithFormat:@"%@",dic[@"address"]];
            _transDate.text =  [NSString stringWithFormat:@"%@",dic[@"passCloseTime"]];
            _boatDate.text =  [NSString stringWithFormat:@"%@",dic[@"loadTime"]];
             _beginDate.text =  [NSString stringWithFormat:@"%@",dic[@"leaveTime"]];
            _weight.text =  [NSString stringWithFormat:@"%@",dic[@"containerNum"]];
        }
    }
}

-(void)fetchDatabaseFailed:(NSError *)error message:(NSString *)message{
    
    [self dismissWaitDialog];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
